package com.yunji.common.enums.common;

import com.yunji.common.utils.bean.BeanUtils;
import lombok.Getter;

@Getter
public enum UserType {
    PLATE("00", "平台"),
    AGENT("11", "代理商"),
    STAFF("12", "员工"),
    SITE("13", "网点"),
    USER("21", "客户");
    private final String code;
    private final String text;

    UserType(String code, String text) {
        this.code = code;
        this.text = text;
    }

    public static String getText(String code) {
        if (BeanUtils.isNull(code)) {
            return null;
        }
        UserType[] enums = UserType.values();
        for (UserType e : enums) {
            if (e.code.equals(code)) {
                return e.text;
            }
        }
        return null;
    }
}
